/*
 * @Author: xuwejie 1529315455@qq.com
 * @Date: 2023-10-12 11:06:30
 * @LastEditors: raoyonggang 11886335+ryg321@user.noreply.gitee.com
 * @LastEditTime: 2024-04-15 15:37:40
 * @FilePath: \v9\src\store\modules\order.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

let addwidthList = [{ id: 1, title: '序号', width: '50' }, { id: 100, title: '拖动', width: '34' }, { id: 2, title: '商品图片', width: '100' }, { id: 3, title: '商品名称', width: '200' }, { id: 4, title: '描述', width: '0' }, { id: 5, title: '单位', width: '0' }, { id: 6, title: '现有库存', width: '0' }, { id: 7, title: '起订量', width: '0' }, { id: 8, title: '指定库存', width: '0' }, { id: 9, title: '数量', width: '160' }, { id: 10, title: '采购价', width: '0' },  { id: 11, title: '单价', width: '260' }, { id: 12, title: '小计', width: '0' }, { id: 13, title: '备注', width: '350' }]
let widthList = [{ id: 1, title: '序号', width: '50' }, { id: 100, title: '拖动', width: '34' }, { id: 2, title: '商品图片', width: '100' }, { id: 3, title: '商品名称', width: '200' }, { id: 4, title: '描述', width: '0' }, { id: 5, title: '单位', width: '0' }, { id: 6, title: '现有库存', width: '0' }, { id: 7, title: '起订量', width: '0' }, { id: 8, title: '指定库存', width: '0' }, { id: 10, title: '采购价', width: '0' }, { id: 9, title: '数量', width: '160' }, { id: 11, title: '单价', width: '260' }, { id: 12, title: '配送单价', width: '160' }, { id: 13, title: '小计', width: '0' }, { id: 14, title: '备注', width: '350' }]
const state = {
  // 缓存新增订单中的商品表格宽度
  addShopTableWidthList: localStorage.getItem("addOrEditOrder1") || JSON.stringify(addwidthList),
  // 缓存修改订单中的商品表格宽度
  shopTableWidthList: localStorage.getItem("editOrEditOrder1") || JSON.stringify(widthList),
};

const mutations = {
  // 修改新增订单中的商品表格宽度
  ADDBLEWIDTH: (state, data) => {
    state.addShopTableWidthList = JSON.stringify(data)
    // addOrEditOrder代表新增/修改订单中的商品表格
    localStorage.setItem('addOrEditOrder1', JSON.stringify(data))
  },
  // 修改订单中的商品表格宽度
  CHANGETABLEWIDTH: (state, data) => {
    state.shopTableWidthList = JSON.stringify(data)
    // addOrEditOrder代表新增/修改订单中的商品表格
    localStorage.setItem('editOrEditOrder1', JSON.stringify(data))
  }
};

const actions = {
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
